if(CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES AppleClang)
    check_cxx_compiler_flag("-mamx-int8 -mamx-tile" COMPILER_SUPPORTS_AMX)
    if (COMPILER_SUPPORTS_AMX)
        set_property(SOURCE ex10_test.cpp APPEND PROPERTY COMPILE_OPTIONS "-DCOMPILER_SUPPORTS_AMX")
        if( benchmark_FOUND )
                set_property(SOURCE ex10_bench.cpp APPEND PROPERTY COMPILE_OPTIONS "-DCOMPILER_SUPPORTS_AMX")
        endif()
        set(amx_ex10_ass amx_interleaved_gemm_ass.s)
    endif()
elseif(MSVC)
    set(amx_ex10_ass amx_interleaved_gemm_ass.asm)
    set_property(SOURCE ex10_test.cpp APPEND PROPERTY COMPILE_OPTIONS "/DCOMPILER_SUPPORTS_AMX")
endif()
set(amx_ex10_srcs ex10_test.cpp ${amx_ex10_ass})
add_executable(amx_ex10_tests ${amx_ex10_srcs})
target_link_libraries(amx_ex10_tests gtest_main optimisation_common)

IF( benchmark_FOUND )
  add_executable(amx_ex10_bench ex10_bench.cpp ex10_cpp_bench.cpp ${amx_ex10_ass} )
  target_link_libraries(amx_ex10_bench benchmark::benchmark optimisation_common)
ENDIF()

add_test(NAME amx_ex10_test COMMAND amx_ex10_tests)
